package com.mjlf.hometeach.common.db.assit;

import com.mjlf.hometeach.common.db.provider.assit.SubjectProvider;
import com.mjlf.hometeach.common.entity.assit.Subject;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @auther a123
 * @create 2018-05-05 18:29
 * @desc 科目DAO
 */
@Mapper
public interface SubjectDao {

    /**
     * 保存科目信息
     * @param subject
     * @return
     */
    @InsertProvider(type = SubjectProvider.class, method = "save")
    @Options(useGeneratedKeys = true)
    int save(Subject subject);

    /**
     * 根据id删除科目信息
     * @param subjectId
     * @return
     */
    @DeleteProvider(type = SubjectProvider.class, method = "deleteById")
    int deleteById(@Param("id") Integer subjectId);

    /**
     * 根据id查询科目信息
     * @param subjectId
     * @return
     */
    @SelectProvider(type = SubjectProvider.class, method = "getSubjectById")
    Subject getSubjectById(@Param("id") Integer subjectId);

    /**
     * 根据类别查询科目列表
     * @param classifyId
     * @return
     */
    @SelectProvider(type = SubjectProvider.class, method = "listSubjectByClassifyId")
    List<Subject> listSubjectByClassifyId(@Param("classifyId") Integer classifyId);

    /**
     * 根据条件查询科目列表
     * @return
     */
    @SelectProvider(type = SubjectProvider.class, method = "listSubjectByCondition")
    List<Subject> listSubjectByCondition(Subject subject);
}
